$('.sub').click(function () {
	$.ajax({
		url: 'http://localhost:3000/admin/userLogin',
		method: 'POST',
		data: $('#myForm').serialize(),
		success: function (data) {
			console.log(data);
			// alert(data.msg);
			if (data.state == 1) {
				sessionStorage.setItem('pwd', $('.pwd').val());
				sessionStorage.setItem('userobj', JSON.stringify(data.data));
				sessionStorage.setItem('loginuser', data.data.username);
				sessionStorage.setItem('userid', data.data.id);
				layer.msg('登录成功', { icon: 1, time: 900 }, function () {
					location.href = './index.html';
				});
			} else {
				layer.msg('登录失败', {
					icon: 2, // 成功图标
					time: 1200
				});
			}
		}
	});
});
